cmake_minimum_required(VERSION 3.13)
project(utils C CXX)

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

set(PROJECT_SRC
    src/refcount.c
    src/event.c
    src/allocator.c
    src/ringbuffer.c
    src/cfgproxy.c
    src/message_queue.c)

add_library(${PROJECT_NAME} SHARED ${PROJECT_SRC})

target_include_directories(${PROJECT_NAME} PRIVATE include)
target_link_libraries(${PROJECT_NAME} PUBLIC Threads::Threads)

add_subdirectory(test)
